package cn.tedu.stu.controller;

import java.util.Arrays;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.tedu.stu.pojo.Student;

@RestController // 标识身份
public class StudentController {
	
	 @RequestMapping("/stu/add") public String add(@RequestParam("pid") Integer
	 pid,String name,Integer age,String[] hobby) { //SpringMVC会自动把pid封装到方法的参数中
	 System.out.println("pid:"+pid); System.out.println("name:"+name);
	 System.out.println("age:"+age);
	 System.out.println("hobby:"+Arrays.deepToString(hobby));
	 
	 
	 return "123"; }
	
	 @RequestMapping("/stu/add2")
		public Student add2(Student student) {
			System.out.println(student);		//打印student对象，调用toString()
			
			return student;  //返回json对象，在页面展示
		}
}
